<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
 <link href="/Projecttwo/Public/assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="/Projecttwo/Public/css/admin/style.css"/>
        <link rel="stylesheet" href="/Projecttwo/Public/css/admin/adminstyle.css"/>       
        <link href="/Projecttwo/Public/assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="/Projecttwo/Public/assets/css/ace.min.css" />
        <link rel="stylesheet" href="/Projecttwo/Public/fonts/admin/css/font-awesome.min.css" />
        <!--[if lte IE 8]>
		  <link rel="stylesheet" href="/Projecttwo/Public/assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="/Projecttwo/Public/js/admin/jquery-1.9.1.min.js"></script>
		<script src="/Projecttwo/Public/assets/js/typeahead-bs2.min.js"></script>   
        <script src="/Projecttwo/Public/js/admin/lrtk.js" type="text/javascript" ></script>		
		<script src="/Projecttwo/Public/assets/js/jquery.dataTables.min.js"></script>
		<script src="/Projecttwo/Public/assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="/Projecttwo/Public/assets/layer/layer.js" type="text/javascript" ></script>          
        <script type="text/javascript" src="/Projecttwo/Public/Widget/swfupload/swfupload.js"></script>
        <script type="text/javascript" src="/Projecttwo/Public/Widget/swfupload/swfupload.queue.js"></script>
        <script type="text/javascript" src="/Projecttwo/Public/Widget/swfupload/swfupload.speed.js"></script>
        <script type="text/javascript" src="/Projecttwo/Public/Widget/swfupload/handlers.js"></script>
        
<title>广告管理</title>
</head>

<body>
<!-- 接收上传后返回的信息 -->
<input type="hidden" value="<?php echo ($info); ?>" id="info">
<input type="hidden" value="<?php echo ($error); ?>" id="error">
<div class=" clearfix" id="advertising">
       <div id="scrollsidebar" class="left_Treeview">
    <div class="show_btn" id="rightArrow"><span></span></div>
    <div class="widget-box side_content" >
    <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
     <div class="side_list">
      <div class="widget-header header-color-green2">
          <h4 class="lighter smaller">广告图分类</h4>
      </div>
      <div class="widget-body">
         <ul class="b_P_Sort_list">
             <li><i class="orange  fa fa-user-secret"></i><a href="#">全部(235)</a></li>
             <li><i class="fa fa-image pink "></i> <a href="#">首页轮播广告大(5)</a></li>
             <li> <i class="fa fa-image pink "></i> <a href="#">轮播广告小1(3)</a> </li>
             <li> <i class="fa fa-image pink "></i> <a href="#">轮播广告小2(3)</a></li>
             <li><i class="fa fa-image pink "></i> <a href="#">单个广告(6)</a></li>
         </ul>
  </div>
  </div>
  </div>  
  </div><div class="Ads_list">
   <div class="border clearfix">
       <span class="l_f">
        <a href="javascript:void()" id="ads_add" class="btn btn-warning"><i class="fa fa-plus"></i> 添加广告</a>
        <a href="javascript:void()" class="btn btn-danger"><i class="fa fa-trash"></i> 批量删除</a>
       </span>
       <span class="r_f">共：<b>45</b>条广告</span>
     </div>
     <div class="Ads_lists">
       <table class="table table-striped table-bordered table-hover" id="sample-table">
		<thead>
		 <tr>
				<th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
				<th width="80">ID</th>
                <th>排序</th>
				<th width="100">分类</th>
				<th width="220px">图片</th>
				<th width="150px">尺寸（大小）</th>
				<th width="250px">链接地址</th>
				<th width="180px">加入时间</th>
				<th width="70px">状态</th>                
				<th width="250px">操作</th>
			</tr>
		</thead>
	<tbody>
	<?php if(is_array($pdoArr)): foreach($pdoArr as $key=>$v): ?><tr>
       <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
       <td><?php echo ($v['id']); ?></td>
       <td><input name="" type="text"  style=" width:50px" placeholder="1"/></td>
       <td><?php echo ($v['typename']); ?></td>
       <td><span class="ad_img"><img src="/Projecttwo/Public/upload/adv/<?php echo ($v['imagename']); ?>"  width="100%" height="100%"/></span></td>
       <td><?php echo ($v['height']); ?>×<?php echo ($v['width']); ?></td>
       <td><a href="#" target="_blank"><?php echo ($v['url']); ?></a></td>
       <td><?php echo (date("Y-m-d , H:i:s",$v['time'])); ?></td>
       <td class="td-status"><span class="label label-success radius"><?php if($v['isshow'] == 1): ?>显示<?php else: ?>不显示<?php endif; ?></span></td>
      <td class="td-manage">
        <a onClick="member_stop(this,'10001')"  href="javascript:;" title="停用"  class="btn btn-xs btn-success"><i class="fa fa-check  bigger-120"></i></a>   
        <a title="编辑" onclick="member_edit('编辑','member-add.html','4','','510')" href="javascript:;"  class="btn btn-xs btn-info" ><i class="fa fa-edit bigger-120"></i></a>      
        <a title="删除" href="javascript:;"  onclick="member_del(this,'1')" class="btn btn-xs btn-warning" ><i class="fa fa-trash  bigger-120"></i></a>
       </td>
      </tr><?php endforeach; endif; ?>
    </tbody>
    </table>
     </div>
 </div>
</div>
<!--添加广告样式-->
<form action="/Projecttwo/index.php/Admin/Advinfo/advOper" method="post" id="form" enctype="multipart/form-data">
<div id="add_ads_style"  style="display:none">
 <div class="add_adverts">
 <ul>
  <li>
  <label class="label_name">所属分类</label>
  <span class="cont_style">
  <select class="form-control" id="form-field-select-1" name="typename">
    <option value="">选择分类</option>
    <option value="1">首页大幻灯片</option>
    <option value="2">首页小幻灯片</option>
    <option value="3">单广告图</option>
    <option value="4">其他广告</option>
    <option value="5">板块栏目广告</option>
  </select></span>
  </li>
  <li><label class="label_name">图片尺寸</label><span class="cont_style">
  <input name="height" type="text" id="form-field-1" id="height" placeholder="0" class="col-xs-10 col-sm-5" style="width:80px">
  <span class="l_f" style="margin-left:10px;">x</span><input name="width" type="text" id="width" id="form-field-1" placeholder="0" class="col-xs-10 col-sm-5" style="width:80px"></span></li>
  <li><label class="label_name">显示排序</label><span class="cont_style"><input name="ord" type="text" id="ord" id="form-field-1" placeholder="0" class="col-xs-10 col-sm-5" style="width:50px"></span></li>
  <li><label class="label_name">链接地址</label><span class="cont_style"><input name="url" type="text" id="url" id="form-field-1" placeholder="地址" class="col-xs-10 col-sm-5" style="width:450px"></span></li>
   <li><label class="label_name">状&nbsp;&nbsp;态：</label>
   <span class="cont_style">
     &nbsp;&nbsp;<label><input name="isshow" type="radio" checked="checked" class="ace"><span class="lbl">显示</span></label>&nbsp;&nbsp;&nbsp;
     <label><input name="isshow" type="radio" class="ace"><span class="lbl">隐藏</span></label></span><div class="prompt r_f"></div>
     </li>
     <li><label class="label_name">图片</label><span class="cont_style">
 <div class="demo">
	           <div class="logobox"><div class="resizebox"><img src="images/image.png" width="100px" alt="" height="100px"/></div></div>	
               <div class="logoupload">
                 <span class="btn-upload">
 					<a href="javascript:void();" class="btn btn-primary radius" > 浏览文件</a>
 					<input type="file" multiple name="file_0" class="input-file">
				</span>


                  
                  <div style="clear:both;height:0;overflow:hidden;"></div>
                  <div class="progress-box" style="display:none;">
                    <div class="progress-num">上传进度：<b>0%</b></div>
                    <div class="progress-bar"><div style="width:0%;" class="bar-line"></div></div>
                  </div>  <div class="prompt"><p>图片大小小于5MB,支持.jpg;.gif;.png;.jpeg格式的图片</p></div>  
              </div>                                
           </div>           
   </span>
  </li>
 
  
 </ul>
 </div>
</div>
</body>
<script type="text/javascript">
//初始化宽度、高度  
$(".widget-box").height($(window).height()); 
$(".Ads_list").width($(window).width()-220);
 //当文档窗口发生改变时 触发  
   $(window).resize(function(){
	$(".widget-box").height($(window).height());
	 $(".Ads_list").width($(window).width()-220);
	});
	$(function() { 
	$("#advertising").fix({
		float : 'left',
		//minStatue : true,
		skin : 'green',	
		durationTime :false,
		stylewidth:'220',
		spacingw:30,//设置隐藏时的距离
	    spacingh:250,//设置显示时间距
		set_scrollsidebar:'.Ads_style',
		table_menu:'.Ads_list'
	});
});
/*广告图片-停用*/
function member_stop(obj,id){
	layer.confirm('确认要关闭吗？',{icon:0,},function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs " onClick="member_start(this,id)" href="javascript:;" title="显示"><i class="fa fa-close bigger-120"></i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已关闭</span>');
		$(obj).remove();
		layer.msg('关闭!',{icon: 5,time:1000});
	});
}
/*广告图片-启用*/
function member_start(obj,id){
	layer.confirm('确认要显示吗？',{icon:0,},function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="关闭"><i class="fa fa-check  bigger-120"></i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">显示</span>');
		$(obj).remove();
		layer.msg('显示!',{icon: 6,time:1000});
	});
}
/*广告图片-删除*/
function member_del(obj,id){
	layer.confirm('确认要删除吗？',{icon:0,},function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}
/*******添加广告*********/
$('#ads_add').on('click', function(){
	  layer.open({
       type: 1,
       title: '添加广告',
		maxmin: true, 
		shadeClose: false, //点击遮罩关闭层
       area : ['800px' , ''],
       content:$('#add_ads_style'),
		btn:['添加','取消'],
		yes:function(index,layero){	
		 var num=0;
		 var str="";
		 
		 //获取值
		 /* var typename = $('#form-field-select-1').val();
		 var height = $('#height').val();
		 var width = $('#width').val();
		 var odr = $('#odr').val();
		 var url = $('#url').val();
		 var isshow = $('#form-field-radio1').val();
		 //拼写数据
		 var data = 'typename='+typename+'&height='+height+"&width="+width+"&odr="+odr+"&url"+url+"&isshow="+isshow;
		 $.post('/Projecttwo/index.php/Admin/Advinfo/advSave',data,function(obj){
			 if(obj==1){
				 layer.alert('添加成功！',{	icon:1});
			}else{
				layer.alert('添加失败！',{	icon:2});
			}
		 },'json'); */
    $(".add_adverts input[type$='text']").each(function(n){
         if($(this).val()=="")
         {
              
			   layer.alert(str+=""+$(this).attr("name")+"不能为空！\r\n",{
               title: '提示框',				
				icon:0,								
         }); 
		    num++;
           return false;            
         }else{
       	  $('#form').submit();        	  
         } 
		 });
		  	  		     				
		}
   });
})
jQuery(function($) {
				var oTable1 = $('#sample-table').dataTable( {
				"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,2,3,4,5,7,8,]}// 制定列不参与排序
		] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
			
				
			})
</script>
<script type="text/javascript">
var info = $('#info').val();

 if(info !==undefined){
	if(info==1){
		layer.msg('添加成功',{icon:1});
	}else if(info==2){
		layer.msg('图片上传成功！数据添加失败！',{icon:2});
	}else if(info==4){
		layer.msg('图片上传失败！',{icon:2});
	}else if(info==3){
		var error = $('#error').val();
		layer.msg(error,{icon:2});
	}
} 
</script>

</html>